import {defineStore} from "pinia";
import {ref} from "vue";

export const useLowCodeStore = defineStore('lowCode', () => {
    let isShowDrawer = ref(false);
    let currentDrawer = ref({});
    let currentDrawerElementId = ref("");
    let currentDrawerTitle = ref("");
    let lowCodeComponentList = ref([]);
    let lowCodeDrawerJsonInfo = ref({});

    function resetIsShowDrawer(flag) {
        isShowDrawer.value = flag;
    }

    function resetCurrentDrawer(info) {
        currentDrawer.value = info;
    }

    function resetCurrentDrawerElementId(info) {
        currentDrawerElementId.value = info;
    }

    function resetCurrentDrawerTitle(info) {
        currentDrawerTitle.value = info;
    }

    function resetLowCodeComponentList(info) {
        lowCodeComponentList.value = info;
    }

    function resetLowCodeDrawerJsonInfo(info) {
        lowCodeDrawerJsonInfo.value = info;
    }

    return { isShowDrawer, resetIsShowDrawer, currentDrawer, resetCurrentDrawer, currentDrawerElementId, resetCurrentDrawerElementId,
        currentDrawerTitle, resetCurrentDrawerTitle, lowCodeComponentList, resetLowCodeComponentList, lowCodeDrawerJsonInfo, resetLowCodeDrawerJsonInfo }
})